home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Amiga
/
World of Amiga.iso
/
archive
/
assembly
/
dwfilter.lha
/
DWfilter.s
< prev
next >
Wrap
Text File
|
1994-06-05
|
5KB
|
330 lines
Section Test,code
output ram:DWfilter
opt d+
incdir "dh0:Data/docs/include_3/"
include dos/dos_lib.i
include exec/execbase.i
include libraries/gadtools.i
include libraries/gadtools_lib.i
include utility/tagitem.i
incdir dh0:include/
include system
_LVOLockPubScreen EQU -510
_LVOUnlockPubScreen EQU -516
_LVOOpenWindowTagList EQU -606
ME_Lock =0
ME_FIB =4
ME_Temp =8
ME_OldExamine =12
ME_OldExNext =16
ME_DOSBase =20
CALLGAD MACRO
move.l _GadToolsBase,a6
jsr _LVO\1(a6)
ENDM
Start: Lea GFXName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_GfxBase
Beq Error
Lea DosName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_DOSBase
Beq Error
Lea IntName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_IntuitionBase
Beq Error
Lea GadToolsName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_GadToolsBase
Beq Error
bsr RemoveOldExam
bsr GetLine
cmp.l #$80000000,Pat_Dest
beq .quit
bsr InstallNewExam
.quit Move.l _GadToolsBase,A1
CALLEXEC CloseLibrary
Move.l _IntuitionBase,A1
CALLEXEC CloseLibrary
Move.l _DOSBase,A1
CALLEXEC CloseLibrary
Move.l _GfxBase,A1
CALLEXEC CloseLibrary
Error: moveq.l #0,d0
rts
*-------------------------------------------------*
RemoveOldExam:
move.l _DOSBase,a6
lea _LVOExamine(a6),a0
move.l 2(a0),a1
sub.l #My_Examine-MemID,a1
cmp.l #"DWPt",(a1)
bne .exit
Lea TempBuf-MemID(a1),a2
move.l ME_OldExamine(a2),2(a0)
lea _LVOExNext(a6),a0
move.l ME_OldExNext(a2),2(a0)
lea Pat_Src-MemID(a1),a2
lea Gadget00String,a3
.copy move.b (a2)+,(a3)+
tst.b -1(a2)
bne .copy
.exit rts
*-------------------------------------------------*
InstallNewExam:
CALLEXEC Disable
Lea MemID,a4
Lea TempBuf,a5
move.l 8(a4),d0
move.l #$10001,d1
CALLEXEC AllocMem
move.l d0,4(a4)
move.l _DOSBase,a6
move.l a6,ME_DOSBase(a5)
move.l _DOSBase,a6
lea _LVOExamine(a6),a0
move.l 2(a0),ME_OldExamine(a5)
move.l 4(a4),d0
add.l #My_Examine-MemID,d0
move.l d0,2(a0)
lea _LVOExNext(a6),a0
move.l 2(a0),ME_OldExNext(a5)
move.l 4(a4),d0
add.l #My_ExNext-MemID,d0
move.l d0,2(a0)
move.l a4,a0
move.l 4(a4),a1
move.l 8(a4),d0
.copy move.b (a0)+,(a1)+
sub.l #1,d0
bne .copy
CALLEXEC Enable
rts
*-------------------------------------------------*
opt p+
MemID: dc.l "DWPt"
dc.l 0
dc.l MemEnd-MemID
My_Examine: movem.l a0-a6,-(a7)
Lea TempBuf(pc),a1
move.l d1,ME_Lock(a1)
move.l d2,ME_FIB(a1)
move.l #0,ME_Temp(a1)
.file move.l ME_OldExamine(a1),a0
jsr (a0)
tst.l d0
beq .err
Lea TempBuf(pc),a1
move.l ME_FIB(a1),a0
tst.l fib_DirEntryType(a0)
bpl .err
bsr TestFSP
beq .err
move.l 4,a6
move.l ThisTask(a6),a0
move.l LN_NAME(a0),a0
cmp.l #"DW P",(a0)
bne .err
move.l ME_FIB(a1),a0
move.l fib_DiskKey(a0),d2
tst.l ME_Temp(a1)
beq .first
cmp.l ME_Temp(a1),d2
beq .err
.first move.l d2,ME_Temp(a1)
move.l ME_Lock(a1),d1
move.l ME_FIB(a1),d2
bra .file
.err movem.l (a7)+,a0-a6
rts
*-------------------------------------------------*
My_ExNext: movem.l a0-a6,-(a7)
Lea TempBuf(pc),a1
move.l d1,ME_Lock(a1)
move.l d2,ME_FIB(a1)
.file move.l ME_Lock(a1),d1
move.l ME_FIB(a1),d2
move.l ME_OldExNext(a1),a0
jsr (a0)
tst.l d0
beq .err
move.l 4,a6
move.l ThisTask(a6),a0
move.l LN_NAME(a0),a0
cmp.l #"DW P",(a0)
bne .err
Lea TempBuf(pc),a1
move.l ME_FIB(a1),a0
tst.l fib_DirEntryType(a0)
bpl .err
bsr TestFSP
beq .file
.err movem.l (a7)+,a0-a6
rts
*-------------------------------------------------*
TestFSP: movem.l d0/d2-d7/a1-a6,-(a7)
move.l ME_FIB(a1),a0
lea fib_FileName(a0),a0
move.l a0,d2
lea Pat_Dest(pc),a2
move.l a2,d1
move.l ME_DOSBase(a1),a6
jsr _LVOMatchPatternNoCase(a6)
move.l d0,d1
movem.l (a7)+,d0/d2-d7/a1-a6
tst.l d1
rts
TempBuf: dc.l 0 ;ME_Lock
dc.l 0 ;ME_FIB
dc.l 0 ;ME_Temp
dc.l 0 ;ME_OldExamine
dc.l 0 ;ME_OldExNext
dc.l 0 ;ME_DOSBase
Pat_Dest: ds.b 256
Pat_Src: ds.b 256
MemEnd:
opt p-
*-------------------------------------------------*
GetLine: bsr SetupScreen
bsr OpenProject0Window
move.l Project0Wnd,a0
Move.l wd_UserPort(a0),_MyWinUserPort
*-----------------------------------------------*
.WaitLoop Move.l _MyWinUserPort,A0
CALLEXEC WaitPort
Move.l _MyWinUserPort,A0
CALLGAD GT_GetIMsg
Move.l D0,A1
Move.l im_Class(A1),D2 ;D2=IDCMP Flags Directly
Move.w im_Code(A1),D3 ;D3=Data ie key why class=Rawkey
Move.w im_Qualifier(A1),D4 ;D4=things like CTRL SHIFT
Move.w im_MouseX(a1),D5 ;D5=MouseX Coordinate
Move.w im_MouseY(a1),D6 ;D5=MouseY Coordinate
Move.l im_IAddress(A1),D7 ;D7=Addres of Intuition Obj ie Gadget
Movem.l D0-D7/A0-A6,-(A7)
CALLGAD GT_ReplyIMsg
Movem.l (a7)+,D0-D7/A0-A6
cmp.l #GADGETUP,d2
beq .exit
Cmp.l #CLOSEWINDOW,D2
bne .WaitLoop
.exit move.l Project0Gadgets+(0*4),a0
move.l 80(a0),a0
lea Pat_Src,a1
.loop move.b (a0),d0
cmp.b #"a",d0
blt .upper
cmp.b #"z",d0
bgt .upper
and.b #223,d0
.upper move.b d0,(a1)+
tst.b (a0)+
bne .loop
move.l #Pat_Src,d1
move.l #Pat_Dest,d2
move.l #256,d3
CALLDOS ParsePattern
bsr CloseProject0Window
bsr CloseDownScreen
Move.l Scr,A0
CALLINT CloseScreen
rts
*-----------------------------------------------*
include dh0:data/pw/data/DWpat.s
*-----------------------------------------------*
_IntuitionBase dc.l 0
_DOSBase dc.l 0
_GfxBase dc.l 0
_GadToolsBase dc.l 0
_MyWinUserPort dc.l 0
GFXName GRAFNAME
IntName INTNAME
DosName DOSNAME
GadToolsName dc.b "gadtools.library",0
even
Temp: dc.l 0
end